package com.das.mechanic_alone.widget;

import android.content.Context;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.das.mechanic_base.R;
import com.das.mechanic_base.adapter.alone.X3AloneAnswerAdapter;
import com.das.mechanic_base.base.X3BaseSelfBottomSheetDialog;
import com.das.mechanic_base.bean.alone.AloneNewBean;
import com.das.mechanic_base.utils.X3ScreenUtils;
import com.das.mechanic_base.widget.X3MaxHeightRecyclerView;
import com.umeng.analytics.MobclickAgent;

import java.util.List;

public class X3BottomAloneAnswerDialog extends X3BaseSelfBottomSheetDialog {

    TextView tv_title;
    X3MaxHeightRecyclerView rlv_answer;
    private X3AloneAnswerAdapter answerAdapter;

    public X3BottomAloneAnswerDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected boolean getDialogCancel() {
        return false;
    }

    @Override
    protected void initView() {
        tv_title = getView(R.id.tv_title);
        rlv_answer = getView(R.id.rlv_answer);

        rlv_answer.setLayoutManager(new LinearLayoutManager(mContext));
        answerAdapter = new X3AloneAnswerAdapter(mContext);
        rlv_answer.setAdapter(answerAdapter);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.x3_alone_answer_service;
    }

    @Override
    protected int getDialogHeight() {
        return X3ScreenUtils.getScreenHeight(mContext) * 3 / 5;
    }

    public void changeData(String title, List<AloneNewBean.ItemQuestionListBean.QuestionDetectionTempletQuestionListBean.QuestionCarMilesDeductionEntityListBean> mList){
        tv_title.setText(title + "");
        if (answerAdapter != null) {
            answerAdapter.changeData(mList);
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
        MobclickAgent.onPageStart("检测系统详情检测点答案弹窗");
    }

    @Override
    protected void onStop() {
        super.onStop();
        MobclickAgent.onPageEnd("检测系统详情检测点答案弹窗");
    }
}
